<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
    <!-- Google Chrome Frame也可以让IE用上Chrome的引擎: -->
    <meta name="renderer" content="webkit">
    <!--国产浏览器高速模式-->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="穷在闹市"/>
    <!-- 作者 -->
    <meta name="revised" content="穷在闹市.v3, 2019/05/01"/>
    <!-- 定义页面的最新版本 -->
    <meta name="description" content="网站简介"/>
    <!-- 网站简介 -->
    <meta name="keywords" content="搜索关键字，以半角英文逗号隔开"/>
    <title>穷在闹市出品</title>

    <!-- 公共样式 开始 -->
    <link rel="stylesheet" type="text/css" href="../css/base.css">
    <link rel="stylesheet" type="text/css" href="../fonts/iconfont.css">
    <script type="text/javascript" src="../framework/jquery-1.11.3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../layui/css/layui.css">
    <script type="text/javascript" src="../layui/layui.js"></script>
    <script src="../framework/cframe.js"></script><!-- 仅供所有子页面使用 -->
    <!-- 公共样式 结束 -->
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <style>
        .layui-form {
            margin-right: 30%;
        }
    </style>

</head>

<body>
<div class="cBody">
    <form id="addForm" class="layui-form" action="/attendance/update" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">出勤</label>
            <div class="layui-input-inline shortInput">
              <select name="info" id="provid" lay-filter="provid">

              </select>

            </div>
        </div>
        <input type="text" hidden="hidden" id="id"  name="id" value="${attendance.id}">
        <div class="layui-form-item">
            <label class="layui-form-label">开始时间</label>
            <div class="layui-input-inline shortInput">
                <input type="date" name="startdata"  autocomplete="off"
                value="${attendance.startdata}"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结束时间</label>
            <div class="layui-input-inline shortInput">
                <input type="date" name="enddata"  autocomplete="off"
               value="${attendance.enddata}"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">出勤时间</label>
            <div class="layui-input-inline shortInput">
                <input type="date" name="data"  autocomplete="off"
                value="${attendance.data}"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline shortInput">
                <c:if test="${attendance.stuta==0}">
                    <input type="radio" name="stuta" value="1" title="启用" autocomplete="off" class="layui-input">
                    <input type="radio" checked="checked" name="stuta" value="0" title="禁用" autocomplete="off" class="layui-input">
                </c:if>
                <c:if test="${attendance.stuta==1}">
                    <input type="radio" checked="checked" name="stuta" value="1" title="启用" autocomplete="off" class="layui-input">
                    <input type="radio"  name="stuta" value="0" title="禁用" autocomplete="off" class="layui-input">
                </c:if>

            </div>

        </div>
        <div class="layui-form-item"  id="stu_id">
            <label class="layui-form-label">学生ID</label>
            <div class="layui-input-inline shortInput">
                <input type="text" name="stu_id" value="${attendance.student.stuname}" autocomplete="off" class="layui-input">
            </div>

        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">老师</label>
            <div class="layui-input-inline shortInput">
                <input type="text" name="t_id" value="${login.name}" autocomplete="off" class="layui-input">
            </div>

        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="submitBut">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>

</div>
</body>
<script type="text/javascript">
    layui.use(['upload', 'form'], function () {
        var form = layui.form;
        var upload = layui.upload;
        var layer = layui.layer;
        console.log(upload);
        $(function () {

            $.ajax({
                url: "/attendance/ajaxQuery",
                type: "POST",
                success: function (data) {
                    var jsons = JSON.parse(data);
                    var html = "";
                    var id = $("#id").val();
                    console.log(jsons)
                    for (var i = 0; i < jsons.length; i++) {
                        if (id != jsons[i].id) {
                            html += "<option value=" + jsons[i].id + ">"
                                + jsons[i].info + "</option>";
                        } else {
                            html += "<option  selected='selected' value=" + jsons[i].id + ">"
                                + jsons[i].info + "</option>";
                        }
                    }
                    $("#provid").html(html);
                    form.render('select');
                }
            });
        });
    })
</script>

</html>